package sk.ogame.realm.utils;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @author 支绍昆
 * 2023/2/27
 **/
public class RandomUtil {

    private static final char[] charAndDigitArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

    public static String charAndDigit(int count) {
        char[] arr = new char[count];
        for (int i = 0; i < count; i++) {
            int r = ThreadLocalRandom.current().nextInt(36);
            arr[i] = charAndDigitArr[r];
        }
        return new String(arr);
    }
}
